package com.zl.tby.icc;

import lombok.Data;
import org.noear.wood.utils.StringUtils;

/**
 * 设备信息
 * @author changpeng
 * @version 1.0
 * @since 2024/9/17 8:29
 */
@Data
public class TbyDeviceInfo {
    private String deviceName;
    private String deviceCode;
    private String lon;
    private String lat;
    private String channelId;
    private String cameraType;
    /**在线状态，0：离线 1：在线*/
    private Integer isOnline;
    /**设备大类*/
    private Integer deviceCategory;
    /**设备小类*/
    private String deviceType;
    /**设备ip*/
    private String deviceIp;
    public static TbyDeviceInfo createByIccDeviceInfo(IccDeviceInfo device) {
        String channelId = device.getChannelId();
        if (StringUtils.isNotEmpty(channelId)) {
            TbyDeviceInfo entity = new TbyDeviceInfo();
            entity.setDeviceName(device.getDeviceName());
            entity.setDeviceCode(device.getDeviceCode());
            entity.setChannelId(device.getChannelId());
            entity.setLon(device.getLon());
            entity.setLat(device.getLat());
            entity.setIsOnline(device.getIsOnline());
            entity.setDeviceCategory(device.getDeviceCategory());
            entity.setDeviceType(device.getDeviceType());
            entity.setDeviceIp(device.getDeviceIp());
            entity.setCameraType(device.getCameraType());
            return entity;
        }
        return null;
    }
}
